package com.action.wx.order;

import com.bean.Product;

import java.io.Serializable;

/**
 * Created by Administrator on 2018-10-12.
 */
public class BuyerItem implements Serializable {

    private static final long serialVersionUID = 1L;
    //商品
    private Product product;
    //购买数量
    private Integer amount = 1;

    public void setProduct(Product product) {
        this.product = product;
    }

    public void setAmount(Integer amount) {
        this.amount = amount;
    }

    public Integer getAmount() {
        return amount;
    }

    public Product getProduct() {
        return product;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((product == null) ? 0 : product.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) //比较地址
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        BuyerItem other = (BuyerItem) obj;
        if (product == null) {
            if (other.product != null)
                return false;
        } else if (!product.getId().equals(other.product.getId()))
            return false;
        return true;
    }

}
